<template>
	<view class="">

	</view>
</template>
<script>
	export default {
		globalData: {
			isIphone: false,
		},
		data() {
			return {
				fringeScreenModels: [
					"iPhone 13", "iPhone 13 mini", "iPhone 13 Pro Max", "iPhone 13 Pro",
					"iPhone 11", "iPhone XR",
					"iPhone 12", "iPhone 12 mini", "iPhone 12 Pro Max", "iPhone 12 Pro",
					"iPhone 11", "iPhone 11 mini", "iPhone 11 Pro Max", "iPhone 11 Pro",
					"iPhone X", "iPhone x", "vivo X21A", "ASUS Zenfone 5",
					"Ulefone T2 Pro", "Leagoo S9", "HUAWEI P20", "DooGee V",
					"OPPO R15", "LG G7", "SAMSUNG S9", "COR-AL00",
					"vivo Y83A", "LLD-AL20", "vivo Z1", "PACM00", "PAAM00",

				],

			}
		},

		onShareAppMessage() {},
		onLaunch: function() {
			if (uni.canIUse('getUpdateManager')) {
				const updateManager = uni.getUpdateManager()
				updateManager.onCheckForUpdate(function(res) {
					console.log('onCheckForUpdate====', res)
					// 请求完新版本信息的回调
					if (res.hasUpdate) {
						console.log('res.hasUpdate====')
						updateManager.onUpdateReady(function() {
							uni.showModal({
								title: '更新提示',
								content: '新版本已经准备好，是否重启应用？',
								success: function(res) {
									console.log('success====', res)
									// res: {errMsg: "showModal: ok", cancel: false, confirm: true}
									if (res.confirm) {
										// 新的版本已经下载好，调用 applyUpdate 应用新版本并重启
										updateManager.applyUpdate()
									}
								}
							})
						})
						updateManager.onUpdateFailed(function() {
							// 新的版本下载失败
							uni.showModal({
								title: '已经有新版本了哟~',
								content: '新版本已经上线啦~，请您删除当前小程序，重新搜索打开哟~'
							})
						})
					}
				})
			}
			console.log('App Launch')


			// 获取拼接图片和文件链接的根

		},

		onShow: function() {
			console.log('App Show1')
			this.globalData.isIphone = this.getSystem() ?
				'padding-bottom:50rpx' : ''
			console.log('this.globalData.isIphone', this.globalData.isIphone)

		},
		onHide: function() {
			console.log('App Hide')
		},
		methods: {

			getSystem() {
				for (let i in this.fringeScreenModels) {
					if (uni.getSystemInfoSync().model.indexOf(this.fringeScreenModels[i]) > -1) {
						// 是已知机型里的刘海手机
						return true;
					}
				}
				return false;

			}
		},

	}
</script>

<style >
	@import '/static/font/iconfont.css';
	.margin-20{
		margin: 0 20rpx;
	}
	::-webkit-scrollbar {
	 width: 0;
	 height: 0;
	 color: transparent;
	}

</style>